<template>
  <basic-container element-loading-text="数据加载中..." class="basic-from">
    <p class="title">
      心理评估
      <el-button @click="$store.commit('delHistoryRoute', $route.fullPath)" class="fr" size="mini" type="primary">返回</el-button>
    </p>
    <el-divider></el-divider>
    <div class="wrapper">
      <div>
        <span class="weight">姓名:</span>
        {{ formData.name }}
      </div>
      <div>
        <span class="weight">性别:</span>
        {{ formData.gender | dict("gender") }}
      </div>
      <!-- <div>
        <span class="weight">临床医师:</span>
        {{formData.name}}
      </div>
      <div>
        <span class="weight">护士:</span>
        {{formData.name}}
      </div>
      <div>
        <span class="weight">心理医师:</span>
        {{formData.name}}
      </div>-->
      <div>
        <span class="weight">隔离点:</span>
        {{ formData.hotelName }}
      </div>
      <div>
        <span class="weight">建档日期:</span>
        {{ formData.creatime }}
      </div>
      <div>
        <span class="weight">更新日期:</span>
        {{ formData.moditime }}
      </div>
    </div>
    <div class="flBox">
      <el-tabs type="border-card" v-if="assessDetailsShow" v-model="activeName" @tab-click="accountingScores()" :before-leave="leaveTab">
        <el-tab-pane label="失眠严重指数(ISI)" name="失眠严重指数(ISI)">
          <p class="title" style="color:#0189e5;">
            失眠严重指数（ISI）
            <el-button type="primary" class="fr" @click="aKeyChoice('失眠严重指数(ISI)')" :disabled="type == 'preview'">一键选无</el-button>
          </p>
          <el-table :show-header="false" :data="dataIsiArr" stripe style="width: 100%">
            <el-table-column width="320">
              <template slot-scope="scope">
                {{
                insomniaList(scope.row.name)
                }}
              </template>
            </el-table-column>
            <el-table-column>
              <template slot-scope="scope">
                <el-radio-group v-model="scope.row.value" :disabled="type == 'preview'">
                  <el-radio label="0">无</el-radio>
                  <el-radio label="1">轻度</el-radio>
                  <el-radio label="2">中度</el-radio>
                  <el-radio label="3">重度</el-radio>
                  <el-radio label="4">极重度</el-radio>
                </el-radio-group>
              </template>
            </el-table-column>
          </el-table>
		  
          <el-button type="primary" class="fr mt20 mr20" @click="insomniaValidation()&& (activeName = '心理健康问卷（PHQ-9）')">下一步</el-button>
		  <el-button type="danger" class="fr mt20 mr20" v-if="type != 'preview'" @click="notfit()">不适用</el-button>
        </el-tab-pane>
        <el-tab-pane label="心理健康问卷（PHQ-9）" name="心理健康问卷（PHQ-9）">
          <p class="title" style="color:#0189e5;">
            心理健康问卷（PHQ-9）
            <el-button type="primary" class="fr" @click="aKeyChoice('心理健康问卷（PHQ-9）')" :disabled="type == 'preview'">一键选完全没有</el-button>
          </p>
          <el-table :show-header="false" :data="dataPhq9Arr" stripe style="width: 100%">
            <el-table-column width="270">
              <template slot-scope="scope">
                {{
                mentalHealthList(scope.row.name)
                }}
              </template>
            </el-table-column>
            <el-table-column>
              <template slot-scope="scope">
                <el-radio-group v-model="scope.row.value" :disabled="type == 'preview'">
                  <el-radio label="0">完全没有</el-radio>
                  <el-radio label="1">几天时间</el-radio>
                  <el-radio label="2">一半以上时间</el-radio>
                  <el-radio label="3">几乎每天</el-radio>
                </el-radio-group>
              </template>
            </el-table-column>
          </el-table>
          <div class="mt20">
            <el-button type="primary" class="fr" @click="psychologyValidation()&& (activeName = '焦虑问卷（GAD-7）')">下一步</el-button>
            <el-button class="fr mr20" @click="psychologyValidation()&& (activeName = '失眠严重指数(ISI)')">上一步</el-button>
			<el-button type="danger" class="fr mr20" v-if="type == 'preview'" @click="notfit()">不适用</el-button>
          </div>
        </el-tab-pane>
        <el-tab-pane label="焦虑问卷（GAD-7）" name="焦虑问卷（GAD-7）">
          <p class="title" style="color:#0189e5;">
            焦虑问卷（GAD-7）
            <el-button type="primary" class="fr" @click="aKeyChoice('焦虑问卷（GAD-7）')" :disabled="type == 'preview'">一键选完全没有</el-button>
          </p>
          <el-table :show-header="false" :data="dataGad7Arr" stripe style="width: 100%">
            <el-table-column width="270">
              <template slot-scope="scope">
                {{
                anxietyproblemList(scope.row.name)
                }}
              </template>
            </el-table-column>
            <el-table-column prop="value">
              <template slot-scope="scope">
                <el-radio-group v-model="scope.row.value" :disabled="type == 'preview'">
                  <el-radio label="0">完全没有</el-radio>
                  <el-radio label="1">几天时间</el-radio>
                  <el-radio label="2">一半以上时间</el-radio>
                  <el-radio label="3">几乎每天</el-radio>
                </el-radio-group>
              </template>
            </el-table-column>
          </el-table>
          <div class="mt20">
            <el-button type="primary" class="fr" @click="anxietyValidation()&& (activeName = '综合评估')">下一步</el-button>
            <el-button class="fr mr20" @click="anxietyValidation()&& (activeName = '心理健康问卷（PHQ-9）')">上一步</el-button>
			<el-button type="danger" class="fr mr20" v-if="type != 'preview'" @click="notfit()">不适用</el-button>
          </div>
        </el-tab-pane>
        <el-tab-pane label="综合评估" name="综合评估">
          <p class="title mb20" style="color:#0189e5;">结果</p>
          <table border="1" cellpadding="10" cellspacing="0" style="border:1px solid #909399;">
            <tr>
              <td width="17%" colspan="1">亲友联系人：</td>
              <td width="25%" colspan="1">
                <el-input v-model="formData.contactName" :disabled="type == 'preview'" />
              </td>
              <td width="17%" colspan="1">亲友电话：</td>
              <td width="25%" colspan="1">
                <el-input v-model="formData.contactPhone" :disabled="type == 'preview'" />
              </td>
            </tr>
            <tr>
              <td colspan="1">既往史：</td>
              <td colspan="3">
                <ul style="text-align:left;">
                  <li>
                    1.躯体疾病史：
                    <el-radio-group v-model="formData.isSomaticDiseases" :disabled="type == 'preview'">
                      <el-radio :label="0">否认</el-radio>
                      <el-radio :label="1">有：</el-radio>
                    </el-radio-group>
                    <el-input :disabled="type == 'preview'" v-model="formData.somaticDiseasesRemark" style="width:50%" v-show="formData.isSomaticDiseases == '1'" />
                  </li>
                  <li>
                    2.精神疾病史：
                    <el-radio-group v-model="formData.isMentalIllness" :disabled="type == 'preview'">
                      <el-radio :label="0">否认</el-radio>
                      <el-radio :label="1">有：</el-radio>
                    </el-radio-group>
                    <el-input :disabled="type == 'preview'" v-model="formData.mentalIllnessRemark" style="width:50%" v-show="formData.isMentalIllness == '1'" />
                  </li>
                  <li>
                    3.自伤自杀史：
                    <el-radio-group v-model="formData.isSuicideAndSelfInjury" :disabled="type == 'preview'">
                      <el-radio :label="0">否认</el-radio>
                      <el-radio :label="1">有：</el-radio>
                    </el-radio-group>
                    <el-input :disabled="type == 'preview'" v-model="formData.suicideAndSelfInjuryRemark" style="width:50%" v-show="formData.isSuicideAndSelfInjury == '1'" />
                  </li>
                  <li>
                    4.物质成瘾史：
                    <el-radio-group v-model="formData.isSubstanceAddiction" :disabled="type == 'preview'">
                      <el-radio :label="0">否认</el-radio>
                      <el-radio :label="1">有：</el-radio>
                    </el-radio-group>
                    <el-input :disabled="type == 'preview'" v-model="formData.substanceAddictionRemark" style="width:50%" v-show="formData.isSubstanceAddiction == '1'" />
                  </li>
                  <li>
                    5.重大应激事件：
                    <el-radio-group v-model="formData.isMajorStressEvents" :disabled="type == 'preview'">
                      <el-radio :label="0">否认</el-radio>
                      <el-radio :label="1">有：</el-radio>
                    </el-radio-group>
                    <el-input :disabled="type == 'preview'" v-model="formData.majorStressEventsRemark" style="width:50%" v-show="formData.isMajorStressEvents == '1'" />
                  </li>
                  <li>
                    6.其他补充：
                    <el-input v-model="formData.otherSupplement" style="width:50%" :disabled="type == 'preview'" />
                  </li>
                </ul>
              </td>
            </tr>
            <tr>
              <td colspan="1">对医学观察的态度</td>
              <td colspan="3">
                <ul style="text-align:left;">
                  <li>
                    <el-radio-group v-model="formData.attitudeTowardsMedicalObservation" :disabled="type == 'preview'">
                      <el-radio :disabled="type == 'preview'" v-for="(item, i) in getDict(
                          'attitudeTowardsMedicalObservation'
                        )" :key="item.value" :label="item.value">{{ item.label }}</el-radio>
                    </el-radio-group>
                  </li>
                </ul>
              </td>
            </tr>
            <tr>
              <td colspan="1">自伤自杀风险</td>
              <td colspan="3">
                <ul style="text-align:left;">
                  <li>
                    <el-radio-group v-model="formData.degreeSuicideAndSelfInjury" :disabled="type == 'preview'">
                      <el-radio v-for="(item, i) in getDict(
                          'degreeSuicideAndSelfInjury'
                        )" :key="item.value" :label="item.value">{{item.label}}</el-radio>
                    </el-radio-group>
                  </li>
                </ul>
              </td>
            </tr>
            <tr>
              <td colspan="1">心理现状</td>
              <td colspan="3">
                <el-input type="textarea" v-model="formData.statusQuoinHeart" :disabled="type == 'preview'" />
              </td>
            </tr>
            <tr>
              <td colspan="1">综合评估风险等级</td>
              <td colspan="3">
                <ul style="text-align:left;">
                  <li>
                    <el-radio-group v-model="formData.assessmentRiskLevel" :disabled="type == 'preview'">
                      {{getDict('assessment_riskLevel')}}
                      <el-radio v-for="(item, i) in getDict(
                          'assessment_riskLevel'
                        )" :key="item.value" :label="item.value">{{item.label}}</el-radio>
                    </el-radio-group>
                  </li>
                </ul>
              </td>
            </tr>
            <tr>
              <td width="10%">评估医生：</td>
              <td colspan="1">
                <el-input v-model="formData.assessmentDoctor" :disabled="type == 'preview'" />
              </td>
              <td width="10%">评估日期：</td>
              <td colspan="1">
                <el-date-picker v-model="formData.assessmentTime" type="datetime" :disabled="type == 'preview'" placeholder="选择日期时间" value-format="yyyy-MM-dd HH:mm:ss"></el-date-picker>
              </td>
            </tr>
          </table>

          <div class="zebra">
            <span class="fl">ISI得分：{{ this.formData.scoreIsi }}</span>
            <div class="fr">{{ degree("ISI得分") }}</div>
          </div>
          <div class="zebra">
            <span class="fl">PHQ-9得分：{{ this.formData.scorePhq9 }}</span>
            <div class="fr">{{ degree("PHQ-9得分") }}</div>
          </div>
          <div class="zebra">
            <span class="fl">GAD-7得分：{{ this.formData.scoreGad7 }}</span>
            <div class="fr">{{ degree("GAD-7得分") }}</div>
          </div>
          <div class="mt20">
            <el-button type="primary" class="fr" v-if="type != 'preview'" @click="submit()">完成评估</el-button>
            <el-button class="fr mr20" @click="activeName = '焦虑问卷（GAD-7）'">上一步</el-button>
			<el-button type="danger" class="fr mr20" v-if="type != 'preview'" @click="notfit()">不适用</el-button>
          </div>
        </el-tab-pane>
      </el-tabs>
    </div>
    <div class="frBox">
      <div class="samllTitle">历史评估</div>
      <dataList :menuList="[]" :listLayout="['menu']" :pageInfo="pager" :listData="hstoricalEvaluationList">
        <el-table ref="multipleTable" :data="hstoricalEvaluationList" border @selection-change="($event) => (selectDatinsomniaValidationrr = $event)">
          <el-table-column prop="assessmentTime" label="评估日期"></el-table-column>
          <el-table-column prop="assessmentDoctor" label="评估医生" width="80"></el-table-column>
          <el-table-column label="操作" width="90">
            <template slot-scope="scope">
              <el-button type="text" size="mini" @click="edit(scope.row, 'edit')">修改</el-button>
              <el-button type="text" size="mini" @click="edit(scope.row, 'preview')">查看</el-button>
            </template>
          </el-table-column>
        </el-table>
      </dataList>
    </div>
  </basic-container>
</template>

<script>
import moment from "moment";
import {
  page,
  addOrEdit,
  getObj,
} from "@/views/yq-personnel/api/medicalMonitor.js";
import { mapState } from 'vuex';

export default {
  provide () {
    return {
      //初始化数据
      initList: this.queryData,
    };
  },
  data () {
    return {
      type: "add",
      activeName: "失眠严重指数(ISI)",
      //提交表单
      assessDetailsShow: true,
      formData: {
        current: '',
        assessmentTime: '',
        assessmentRiskLevel: '',
        isSomaticDiseases: '',
        isMentalIllness: '',
        isSuicideAndSelfInjury: '',
        isSubstanceAddiction: '',
        isMajorStressEvents: '',
        attitudeTowardsMedicalObservation: "",
        degreeSuicideAndSelfInjury: "",
        name: "",
        dietaryPattern: "",
        regularSleep: "",
        normalCommunication: "",
        goodCondition: "",
        other: "",
        proposal: "",
        sign: "",
        signFor: "",
        scoreIsi: 0,
        dataIsi: "",
        resultIsi: "",
        scorePhq9: 0,
        dataPhq9: "",
        resultPhq9: "",
        scoreGad7: 0,
        dataGad7: "",
        resultGad7: "",
        assessmentDoctor: "",
        assessmentTime: "",
        resultPhq9: "",
        assessmentResult: "",
      },
      dataIsiArr: [
        { name: "a", value: "" },
        { name: "b", value: "" },
        { name: "c", value: "" },
        { name: "d", value: "" },
        { name: "e", value: "" },
        { name: "f", value: "" },
        { name: "g", value: "" },
      ],
      dataPhq9Arr: [
        { name: "a", value: "" },
        { name: "b", value: "" },
        { name: "c", value: "" },
        { name: "d", value: "" },
        { name: "e", value: "" },
        { name: "f", value: "" },
        { name: "g", value: "" },
        { name: "h", value: "" },
        { name: "i", value: "" },
      ],
      dataGad7Arr: [
        { name: "a", value: "" },
        { name: "b", value: "" },
        { name: "c", value: "" },
        { name: "d", value: "" },
        { name: "e", value: "" },
        { name: "f", value: "" },
        { name: "g", value: "" },
      ],
      hstoricalEvaluationList: [],
      // 请求参数
      params: {
        current: 1,
        size: 20,
        keyword: "",
      },
      // 分页
      pager: {
        total: 0, // 总页数
        current: 1, // 当前页数
        size: 20, // 每页显示多少条
      },
    };
  },
  computed: {
    ...mapState({
      user: (state) => state.user.user,
    }),
  },
  mounted () {
    this.init();
    this.queryData();
    this.formData.assessmentDoctor = this.user.realName
    this.current = this.$route.query.current
  },
  watch: {
    activeName (v) {
      this.accountingScores()
    },
    'formData.isSomaticDiseases' (v) {
      if (v == 0) this.formData.somaticDiseasesRemark = ''
    },
    'formData.isMentalIllness' (v) {
      if (v == 0) this.formData.mentalIllnessRemark = ''

    },
    'formData.isSuicideAndSelfInjury' (v) {
      if (v == 0) this.formData.suicideAndSelfInjuryRemark = ''

    },
    'formData.isSubstanceAddiction' (v) {
      if (v == 0) this.formData.substanceAddictionRemark = ''

    },
    'formData.isMajorStressEvents' (v) {
      if (v == 0) this.formData.majorStressEventsRemark = ''

    },
  },
  methods: {
	  /**
	   * 增加不适用 yaoxf
	   */
	notfit(){
		this.$confirm(`确定 ${this.formData.name} 不适用心理评估？`, "提示", {
		  confirmButtonText: "确定",
		  cancelButtonText: "取消",
		  type: "warning",
		})
		  .then(async () => {
		this.aKeyChoice('失眠严重指数(ISI)');
		this.aKeyChoice('焦虑问卷（GAD-7）');
		this.aKeyChoice('心理健康问卷（PHQ-9）');
		this.formData.statusQuoinHeart = '不适用心理评估。';
		this.formData.assessmentRiskLevel = '0';
		let type = !this.formData.sid ? "add" : "edit";
		await addOrEdit(this.formData, type);
		this.$message.success("保存成功");
		this.$store.commit("delLastRoute", this.$route.path);
		this.queryData();
		this.assessDetailsShow = false;
	})
	},
    aKeyChoice (v) {
      let name = {
        "失眠严重指数(ISI)": "dataIsiArr",
        "心理健康问卷（PHQ-9）": "dataPhq9Arr",
        "焦虑问卷（GAD-7）": "dataGad7Arr",
      }[v];
      this[name] = this[name].map((i) => ({ ...i, value: "0" }));
    },

    insomniaValidation () {
      let type = this.dataIsiArr.some((e) => e.value == "");
      if (type) {
        this.$message.warning(" 失眠严重指数(ISI)请填选完整");
      }
      return !type;
    },
    psychologyValidation () {
      let type = this.dataPhq9Arr.some((e) => e.value == "");
      if (type) {
        this.$message.warning(" 心理健康问卷（PHQ-9）请填选完整");
      }
      return !type;;
    },
    anxietyValidation () {
      let type = this.dataGad7Arr.some((e) => e.value == "");
      if (type) {
        this.$message.warning("焦虑问卷（GAD-7）请填选完整");
      }
      return !type;;
    },
    leaveTab (activeName, oldActiveName) {
      switch (oldActiveName) {
        case "失眠严重指数(ISI)":
          return this.insomniaValidation()
        case "心理健康问卷（PHQ-9）":
          return this.psychologyValidation()
        case "焦虑问卷（GAD-7）":
          return this.anxietyValidation()
      }
    },
    //核算评估分数
    accountingScores () {
      if (this.type !== "preview") {
        this.$nextTick(() => {
          this.formData.scoreIsi = 0;
          this.dataIsiArr.forEach((e) => {
            this.formData.scoreIsi += Number(e.value);
          });
          this.formData.scorePhq9 = 0;
          this.dataPhq9Arr.forEach((e) => {
            this.formData.scorePhq9 += Number(e.value);
          });
          this.formData.scoreGad7 = 0;
          this.dataGad7Arr.forEach((e) => {
            this.formData.scoreGad7 += Number(e.value);
          });
        })
      }
    },
    //历史评估列表编辑按钮监听回调
    async edit (row, type) {
		
      this.type = type;
      let rps = await getObj(row.sid);
	  debugger
      this.formData = rps.data.data;
	  //添加默认选中，防止不适用未填写值导致报错。yaoxf
	  this.aKeyChoice('失眠严重指数(ISI)');
	  this.aKeyChoice('焦虑问卷（GAD-7）');
	  this.aKeyChoice('心理健康问卷（PHQ-9）');
      if (type == "edit" && !this.formData.assessmentTime) {
        this.formData.assessmentTime = moment().format('YYYY-MM-DD HH:mm:ss');
      }
	  if(rps.data.data.dataIsi){
		this.dataIsiArr = JSON.parse(rps.data.data.dataIsi);
	  }
	  if(rps.data.data.dataPhq9){
		this.dataPhq9Arr = JSON.parse(rps.data.data.dataPhq9);
	  }
	  if(rps.data.data.dataGad7){
		this.dataGad7Arr = JSON.parse(rps.data.data.dataGad7);
	  }
	  //----结束添加默认选中
      this.activeName = "失眠严重指数(ISI)";
      this.assessDetailsShow = true;
    },
    degree (v) {
      let str = "";
      if (v == "ISI得分") {
        switch (true) {
          case this.formData.scoreIsi <= 7:
            str = "无显著失眠";
            break;
          case this.formData.scoreIsi > 7 && this.formData.scoreIsi <= 14:
            str = "阀下失眠症";
            break;
          case this.formData.scoreIsi >= 15 && this.formData.scoreIsi <= 21:
            str = "中度失眠症";
            break;
          case this.formData.scoreIsi >= 22 && this.formData.scoreIsi <= 28:
            str = "重度失眠";
            break;
        }
        this.formData.resultIsi = str;
      } else if (v == "PHQ-9得分") {
        switch (true) {
          case this.formData.scorePhq9 <= 4:
            str = "无抑郁";
            break;
          case this.formData.scorePhq9 > 5 && this.formData.scorePhq9 <= 9:
            str = "轻度抑郁";
            break;
          case this.formData.scorePhq9 >= 10 && this.formData.scorePhq9 <= 19:
            str = "中重度抑郁";
            break;
          case this.formData.scorePhq9 >= 20 && this.formData.scorePhq9 <= 27:
            str = "重度抑郁";
            break;
        }
        this.formData.resultPhq9 = str;
      } else if (v == "GAD-7得分") {
        switch (true) {
          case this.formData.scoreGad7 <= 4:
            str = "无焦虑";
            break;
          case this.formData.scoreGad7 > 5 && this.formData.scoreGad7 <= 9:
            str = "轻度焦虑";
            break;
          case this.formData.scoreGad7 >= 10 && this.formData.scoreGad7 <= 14:
            str = "中度焦虑";
            break;
          case this.formData.scoreGad7 >= 15 && this.formData.scoreGad7 <= 21:
            str = "重度焦虑";
            break;
        }
        this.formData.resultGad7 = str;
      }
      return str;
    },
    //失眠问题列表
    insomniaList (v) {
      let obj = {
        a: "1.入睡困难",
        b: "2.睡眠维持困难",
        c: "3.早醒",
        d: "4.对您目前的睡眠模式满意/不满意程度如何",
        e: "5.您认为您的失眠在多大程度上影响了你的日常功能",
        f: "6.你的失眠问题影响了你的生活质量，你觉得在别人眼中你的失眠情况如何？",
        g: "7.您对目前睡眠问题的担心/痛苦程度如何？",
      };
      return obj[v];
    },
    //心理问题列表
    mentalHealthList (v) {
      let obj = {
        a: "1.做事没有兴趣或乐趣",
        b: "2.感到心情低落、沮丧或绝望",
        c: "3.入睡困难、易醒或睡眠过多",
        d: "4.感到疲倦或没有精力",
        e: "5.食欲不振或吃得过多",
        f: "6.觉得自己很糟糕或自己很失败，或让自己或家人失望",
        g: "7.做事情难以专注、例如读报纸或看电视",
        h: "8.行动或说话速度缓慢到别人已经觉察到，或刚好相反一变得比平日更烦躁或坐立不安，以至于走来走去比平常多很多",
        i: "9.有不如死掉的想法，或以某种方式伤害自己的念头",
      };
      return obj[v];
    },
    //焦虑问题列表
    anxietyproblemList (v) {
      let obj = {
        a: "1.感到紧张、焦虑或快要崩溃",
        b: "2.不能停止或控制担忧",
        c: "3.过多的担忧各种各样的事情",
        d: "4.很难放松下来",
        e: "5.不安得难以静坐",
        f: "6.变得容易气恼或易怒",
        g: "7.感到似乎要发生不好的事情而担心受怕",
      };
      return obj[v];
    },

    //完成评估
    submit () {
      let hasNoCheck = [
        "isSomaticDiseases",
        "isMentalIllness",
        "isSuicideAndSelfInjury",
        "isSubstanceAddiction",
        "isMajorStressEvents",
        "otherSupplement",
        "attitudeTowardsMedicalObservation",
        "degreeSuicideAndSelfInjury",
        "statusQuoinHeart",
        'assessmentRiskLevel',
        "contactName",
        "contactPhone",
      ].some(item => !this.formData[item] && this.formData[item] === '')
      if (hasNoCheck) {
        this.$message.error('综合评估填选项不能为空')
        return
      }
      this.$confirm("确定提交本次评估？", "提示", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning",
      })
        .then(async () => {
          this.formData.dataIsi = JSON.stringify(this.dataIsiArr);
          this.formData.dataPhq9 = JSON.stringify(this.dataPhq9Arr);
          this.formData.dataGad7 = JSON.stringify(this.dataGad7Arr);
          let type = !this.formData.sid ? "add" : "edit";
          await addOrEdit(this.formData, type);
          this.$message.success("保存成功");
          this.$store.commit("delLastRoute", this.$route.path);
          this.queryData();
          this.assessDetailsShow = false;
        })
        .catch(() => {
          this.$message.info("已取消提交");
        });
    },
    //进入页面初始化
    init () {
      this.formData = {
        ...this.formData,
        ...JSON.parse(sessionStorage.getItem("assessmentInformation")),
      };
      this.formData.assessmentTime = moment().format('YYYY-MM-DD HH:mm:ss');
    },
    //查询历史评估列表
    async queryData (params = {}) {
      let requestData = {
        ...this.params,
        ...params,
        personId: this.$route.query.personId,
      };
      let rps = await page(requestData);
      const { current, size, total, records } = rps.data.data;
      this.hstoricalEvaluationList = records;
      this.params = requestData;
      this.pager = { total, current, size };
    },
    // //字典翻译
    // dictFormate (row, column, cellValue) {
    //   let dict;
    //   switch (column.property) {
    //     case 'useType':
    //       dict = this.getDict('use_type').find(p => p.value == cellValue)
    //       break;
    //     case 'roomState':
    //       dict = this.getDict('room_state').find(p => p.value == cellValue)
    //       break;
    //   }
    //   return dict ? dict.label : ''
    // },
  },
};
</script>

<style lang="scss" scoped>
ul {
  li {
    height: 37px;
    line-height: 37px;
  }
}
td {
  text-align: center;
}
.green {
  color: #01a43a;
  padding: 0 10px 0 0;
}
.zebra {
  height: 42px;
  line-height: 42px;

  width: 100%;
}
.title {
  padding-left: 10px;
  border-left: 3px solid #0187e2;
}
.weight {
  font-weight: 700;
}
.wrapper {
  /* 转化元素类型 */
  display: grid;
  /* 设置网格的间隙 */
  grid-gap: 5px;
  /* 设置每列的尺寸 */
  grid-template-columns: repeat(5, 1fr);
  margin-bottom: 20px;
}
.flBox {
  width: 69%;
  min-height: 420px;
  float: left;
  .wenxin {
    width: 797px;
    height: 116px;
    font-family: MicrosoftYaHei;
    font-size: 15px;
    font-weight: normal;
    font-stretch: normal;
    line-height: 25px;
    letter-spacing: 0px;
    color: #666666;
    margin-bottom: 50px;
  }
}
.frBox {
  .samllTitle {
    font-weight: 600;
    line-height: 40px;
    font-size: 20px;
    min-height: 40px;
    width: 100%;
    padding-left: 10px;
    border-radius: 5px;
    background-color: #f2f9fd;
  }
  padding: 10px;
  width: 30%;
  min-height: 420px;
  border: 1px solid #dcdfe6;
  float: right;
}
.fr {
  float: right;
}
.dataList {
  padding-top: 0px;
}
</style>
